package com.nullpointer.xchatfinal.object;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;

public class BlockUser {
	private Set<String> blockUsers = new HashSet<>();

	public Set<String> getBlockUsers() {
		return blockUsers;
	}

	public void setBlockUsers(Set<String> blockUsers) {
		this.blockUsers = blockUsers;
	}

	public String toJson() {
		return new JSONSerializer().exclude("*.class").deepSerialize(this);
	}

	public static BlockUser fromJsonToBlockUser(String json) {
		return new JSONDeserializer<BlockUser>().use(null, BlockUser.class)
				.deserialize(json);
	}

	public static String toJsonArray(Collection<BlockUser> collection) {
		return new JSONSerializer().exclude("*.class")
				.deepSerialize(collection);
	}

	public static Collection<BlockUser> fromJsonArrayToBlockUsers(String json) {
		return new JSONDeserializer<List<BlockUser>>()
				.use(null, ArrayList.class).use("values", BlockUser.class)
				.deserialize(json);
	}

}
